#pragma once
#include "TetrisMap.h"

#include <vector>

#include "Vec2.h"

class Block
{
public:
	struct Shape
	{
		std::vector<Vec2> units;
	};
private:
	int x = 0, y = 0;
	int dx = 0;
	Shape shape;
	TetrisMap& map;
public:
	Block(TetrisMap& map);

	void tryMove(int dx);
	void rotate();
	bool move();
	bool tryDrop();

	void setPosition(int x, int y);
	void setShape(Shape& shape);

	int getX()
	{
		return x;
	}

	int getY()
	{
		return y;
	}

	Shape& getShape()
	{
		return shape;
	}
	static Shape newShape(int fixture[4][4], int cx, int cy);
	static void drawBlock(Graphics* graphics, Block& block, int mapx, int mapy, int color);
};

